/*
 * JoinMessage.cpp
 *
 *  Created on: 05/07/2013
 *      Author: gilvan
 */

#include "JoinMessage.h"
#include "Engine.h"

#include <iostream>
#include <cstdlib>

JoinMessage::JoinMessage()
	: Message( "join", false)
{
}

JoinMessage::~JoinMessage() {
}

String JoinMessage::toString(void) const
{
	String msg = "join|0|";

	// join|flag_broadcast|partida|port|nick
	msg.append(partida).append("|").append(port).append("|").append(nick);

	return msg;
}

void JoinMessage::_fromString(const StringVector& tokens)
{
	if( tokens.size() == 5 )
	{
		// join|flag_broadcast|partida|port|nick (requisição para o servidor)
		partida = tokens[2];
		port = tokens[3];
		nick = tokens[4];
	}
}

void JoinMessage::notify(void)
{

}
